/**####################################################################################
  CLASS : qDojo.dijix.TextLink
  ==================================
  - Simple text link
  - CSS: navButton.css
  
  ####################################################################################*/
dojo.provide("qDojo.dijix.TextLink");

dojo.require("dijit._Widget");
dojo.require("dijit._Templated");
dojo.require("dojo.fx");

dojo.declare("qDojo.dijix.TextLink", [dijit._Widget, dijit._Templated] , {

						
		templateString: " <div class=\"dijixTextLink\" dojoAttachPoint=\"buttonNode\" dojoAttachEvent=\"onmouseenter:_onOver,onmouseleave:_onLeave,onclick:_onClick\"> " +
						"	 <div class=\"dijixTextLinkIcon\" dojoAttachPoint=\"iconNode\"></div>" +
						"	 <div dojoAttachPoint=\"containerNode\"></div>"+
						" </div>",
										
		label: 			"",
		iconImage: 		"",
		normalStyle: 	"color:#000000;font-size: 10px;",
		overStyle: 		"color:#FF0000;font-size: 10px;",
		textCSS: 		"",
		// =========================================================================================================
		postCreate: function() {		
			this.inherited(arguments);						
			if(this.label)
				this.containerNode.innerHTML = this.label;																	
			if(this.iconImage){
				var iconPath = dojo.moduleUrl("dojo","../../../") + this.iconImage;
				dojo.style( this.iconNode,"backgroundImage","url("+iconPath+")");				
				this.textCSS = "top: -14px;left: 18px;position:relative;";	
			}else
				this.textCSS = "top: -14px;left: 0px;position:relative;";			
			this.containerNode.style.cssText = this.textCSS + this.normalStyle; 			
			this.buttonNode.style.width = dojo.marginBox(this.containerNode).w + 25 + "px"; // buttonNode width adjustment
		},
		// =========================================================================================================		
		_onOver: function(){			
			this.containerNode.style.cssText = this.textCSS + this.overStyle; 						
		},
		_onLeave: function(){
			this.containerNode.style.cssText = this.textCSS + this.normalStyle; 			
		},
		_onClick: function(){		
			this.onClick();
		},
		onClick: function(e){
			return true;
		}	
});


